/*
 * Copyright (c) 2013, FPX and/or its affiliates. All rights reserved.
 * Use, Copy is subject to authorized license.
 */
package com.syncomponents.util;

import com.syncomponents.core.EnumAck;

/**
 * 转换数据功能
 * 
 * @author sunkey
 * @date May 14, 2014
 */
public abstract class XsltFunctions {

    /**
     * 转换操作结果
     * 
     * @param ack
     * @return
     */
    public static String convertAck(String ack) {
        if ("1".equals(ack)) {
            return EnumAck.Success.getValue();
        } else if ("Y".equalsIgnoreCase(ack)) {
            return EnumAck.Success.getValue();
        } else if ("success".equalsIgnoreCase(ack)) {
            return EnumAck.Success.getValue();
        } else {
            return EnumAck.Failure.getValue();
        }

    }

    /**
     * 增加CDATA
     * 
     * @param str
     * @return
     */
    public static String addCdata(String str) {
        return "<![CDATA[" + str + "]]>";
    }
}
